(function($){
	'use strict';
	var log = function(o){
		return new log.prototype.logInit(o);
	};
	
	log.prototype={
		level:0,
		logInit: function(obj){
			console.log(this.getStr(obj));
		},
	 	getStr:function(obj){
			var ret = '';
			// ret+= '\n in:'+this.level +'\n';
			this.level++;
			var self = this;
			var pret = '';
			for(var i=1; i<this.level;i++){
				pret += '\t';
			}
			if(obj instanceof Object && !Array.isArray(obj)){
				// ret +='\t';
				$.each(obj,function(k,v){
					var pstr =pret+ k+' : ';
					if(v instanceof Object && !Array.isArray(v)){
						pstr += '\n'+self.getStr(v);
					}
					else{
						pstr += v;
					}
					ret = ret + pstr +'\n';
				});
				ret=ret.substring(0,ret.length-1);
			}
			else{
				ret += pret+obj;
			}
			this.level--;
			// ret+= '\n out:'+this.level +'\n';
			return ret;
		}
	};
	log.prototype.logInit.prototype = log.prototype;
	window.log = log;
})(jQuery);
